link_directories (${NEWSYNDROME_BINARY_DIR}/src/libtd_bdd)
include_directories ()

set (libmysql_exist -NOTFOUND)
find_program (libmysql_exist mysql_config)
if (libmysql_exist)
	exec_program (mysql_config ARGS --libs OUTPUT_VARIABLE p_mysql_libs)
	string (REGEX REPLACE "-l[a-z]+" "" mysql_path_libs ${p_mysql_libs})
	link_directories (${mysql_path_libs})
	
	string (REGEX REPLACE "-L[/a-z]+\ " "" mysql_libs ${p_mysql_libs})
	
	exec_program (mysql_config ARGS --include OUTPUT_VARIABLE p_mysql_headers)
	string (REPLACE "-I" "" mysql_headers ${p_mysql_headers})
	include_directories (${mysql_headers})

endif (libmysql_exist)

add_library (parser MODULE parser.c)
add_library (pong MODULE pong.c)
add_library (users_modes MODULE users_modes.c)
add_library (admin MODULE admin.c md5.c admin_gestion_module.c admin_list.c)
add_library (alist MODULE alist.c)
add_library (auth MODULE auth.c md5.c)
add_library (auto MODULE auto.c)
add_library (ban MODULE ban.c ban_gestion.c)
add_library (uptime MODULE uptime.c)
add_library (bruteforce MODULE bruteforce.c)
add_library (coding MODULE coding.c md5.c crc32.c t_hash.c crc16.c)
add_library (conseil MODULE conseil.c)
add_library (contrepeterie MODULE contrepeterie.c)
add_library (ctcp MODULE ctcp.c) 
add_library (joinpart MODULE joinpart.c)
add_library (kick MODULE kick.c)
add_library (log MODULE log.c)
add_library (modes_chans MODULE modes_chans.c)
add_library (pasting MODULE pasting.c pasting_tcp.c pasting_gestion_dcc.c pasting_color.c pasting_color_tab.c)
add_library (say MODULE say.c)
add_library (sysinfo MODULE sysinfo.c)
add_library (topic MODULE topic.c)
add_library (info MODULE info.c)
add_library (rejoin MODULE rejoin.c)
add_library (botinfo MODULE botinfo.c)
add_library (entree MODULE entree.c)
add_library (google MODULE google.c requete.c)
add_library (trad MODULE trad.c requete.c)
add_library (tele MODULE tele.c requete.c)
add_library (compo MODULE compo.c requete.c)
add_library (raw MODULE raw.c)
add_library (modauth MODULE modauth.c md5.c)
add_library (carac MODULE carac.c)
add_library (check_version MODULE check_version.c requete.c)
add_library (talk MODULE talk.c)
add_library (dico MODULE dico.c requete.c)
add_library (telesoir MODULE telesoir.c requete.c rssparser.c)
add_library (extension MODULE extension.c requete.c)

if (libmysql_exist)
	add_library (url_mysql MODULE url_mysql.c module_mysql.c)
	add_library (quote_mysql MODULE quote_mysql.c module_mysql.c)
	add_library (idea_mysql MODULE idea_mysql.c module_mysql.c)
	target_link_libraries (url_mysql ${mysql_libs})
	target_link_libraries (quote_mysql ${mysql_libs})
	target_link_libraries (idea_mysql ${mysql_libs})
endif (libmysql_exist)

add_library (friendbot MODULE friendbot.c md5.c items2.c)
add_library (unmd5 MODULE unmd5.c)

add_library (larva MODULE larva.c)
add_library (coda MODULE coda.c)
add_library (urbandico MODULE urbandico.c requete.c)
# add_library (eval MODULE
# add_library (decrypt_ip MODULE 
add_library (boggle MODULE boggle.c items2.c)
add_library (videolink MODULE videolink.c requete.c)
add_library (nicklen MODULE nicklen.c)
add_library (hlmoi MODULE hlmoi.c)
add_library (mot_proche MODULE mot_proche.c)
add_library (last5 MODULE last5.c)
add_library (livesearch MODULE livesearch.c requete.c rssparser.c)
add_library (sondes MODULE sondes.c)
add_library (lists MODULE lists.c items2.c)

target_link_libraries (friendbot td_bdd)
target_link_libraries (unmd5 td_bdd)
target_link_libraries (auth td_bdd)
target_link_libraries (admin td_bdd)
target_link_libraries (modauth td_bdd)
target_link_libraries (topic td_bdd)
target_link_libraries (modes_chans td_bdd)
target_link_libraries (nicklen td_bdd)
target_link_libraries (auto td_bdd)

